/*
 * @copyright: Huang Ding
 * @Author: ding-cx
 * @Date: 2021-03-19 11:41:39
 * @LastEditors: ding-cx
 * @LastEditTime: 2021-03-29 11:04:39
 * @Description: file content
 */

import { FuncController as Controller } from "../../../libs/controller/Common";

export default class SysConfigController extends Controller {
  model = this.app.model.Sys.Config;

  async getSearchData() {
    const page: [number, number] = this.ctx.request.body.page || [20, 0];
    const data = await this.app.model.Sys.Config.findAndCountAll({
      raw: false,
      limit: page[0],
      offset: page[1],
      order: [["createdAt", "desc"]],
    });
    this.ctx.success(data);
    // const conf = await this.ctx.service.sys.config.getConfigObject();
    // console.log(conf);

  }

  /** 获取系统配置对象 */
  async getConfigObject() {
    const ret = await this.ctx.service.sys.config.getConfigObject();
    this.ctx.success(ret);
  }
}
